package day06_exception_collection.com.itheima.d1_exception;

import java.util.Scanner;

public class Demo6_Exception {
    public static void main(String[] args) {
        while ( true){
            try {
                double price = getPrice();
                System.out.println("商品价格：" + price);
                break;
            } catch (Exception e) {
                System.out.println("价格输入有误，请重新输入！");
            }
        }
    }
    public static double getPrice(){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入商品价格：");
        return sc.nextDouble();
    }
}
